package com.potenza.business.service.impl;

import java.util.List;

import com.potenza.business.domain.DishesTypeDTO;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.potenza.business.mapper.TbDishesTypeMapper;
import com.potenza.business.domain.TbDishesType;
import com.potenza.business.service.ITbDishesTypeService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.client.RestTemplate;

/**
 * dishService业务层处理
 * 
 * @author ruoyi
 * @date 2023-04-21
 */
@Service
public class TbDishesTypeServiceImpl implements ITbDishesTypeService 
{
    @Value("${server.port}")
    String port;

    @Autowired
    private TbDishesTypeMapper tbDishesTypeMapper;

    /**
     * 查询dish
     * 
     * @param id dish主键
     * @return dish
     */
    @Override
    public TbDishesType selectTbDishesTypeById(Long id)
    {
        return tbDishesTypeMapper.selectTbDishesTypeById(id);
    }

    /**
     * 查询dish列表
     * 
     * @param tbDishesType dish
     * @return dish
     */
    @Override
    public List<TbDishesType> selectTbDishesTypeList(TbDishesType tbDishesType)
    {
        return tbDishesTypeMapper.selectTbDishesTypeList(tbDishesType);
    }

    /**
     * 新增dish
     * 
     * @param tbDishesType dish
     * @return 结果
     */
    @Override
    public int insertTbDishesType(TbDishesType tbDishesType)
    {
        tbDishesType.setCreateTime(DateUtils.getNowDate());
        return tbDishesTypeMapper.insertTbDishesType(tbDishesType);
    }

    /**
     * 修改dish
     * 
     * @param tbDishesType dish
     * @return 结果
     */
    @Override
    public int updateTbDishesType(TbDishesType tbDishesType)
    {
        tbDishesType.setUpdateTime(DateUtils.getNowDate());
        return tbDishesTypeMapper.updateTbDishesType(tbDishesType);
    }

    /**
     * 批量删除dish
     * 
     * @param ids 需要删除的dish主键
     * @return 结果
     */
    @Override
    public int deleteTbDishesTypeByIds(Long[] ids)
    {
        return tbDishesTypeMapper.deleteTbDishesTypeByIds(ids);
    }

    /**
     * 删除dish信息
     * 
     * @param id dish主键
     * @return 结果
     */
    @Override
    public int deleteTbDishesTypeById(Long id)
    {
        return tbDishesTypeMapper.deleteTbDishesTypeById(id);
    }

    @Autowired
    RestTemplate restTemplate;

    @Override
    public List<DishesTypeDTO> selectTreeDishesTypeDTO() {
        System.out.println("Port:" + port);
        return tbDishesTypeMapper.selectTreeDishTypeDTO();
    }
}
